import React from 'react'
import { addZan, minusZan } from '../../redux/reducers/zanReducer'
import store from '../../redux/store'
//导入 store 对象
import StateShow from './StateShow'
import StateUpdate from './StateUpdate'
export default function ReduxCom() {
  return (
    <div>
      <StateShow/>
      <StateUpdate/>
      <hr />
      <h2>点赞数：{store.getState().zan}</h2>
      <button onClick={()=>{
        store.dispatch(addZan())
      }}>点赞👍</button>
      <button onClick={()=>{
        store.dispatch(minusZan())
      }}>点踩👎</button>
    </div>
  )
}
